{extend name="base"}
{block name="title"}代理地区查询{/block}
{block name="head"}{/block}
{block name="body"}
<body class="mainbody">
<form>
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>代理地区查询</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <div class="menu-list">
          <input type="button" id="aat" value="添加地区" class="btn yellow" />
        </div>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<div class="table-container">
  <table class="border-table ltable" style="width:auto" data-auto="0">
    <thead>
      <tr>
        <th>ID</th>
        <th>名称</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
{empty name="list"}
      <tr><td colspan="3">Oh~暂无数据!</td></tr>
{else}
  {volist name="list" id="v"}
      <tr data-id="{$v.AgentType}">
        <td>{$v.AgentType}</td>
        <td>{$v.AgentTypeName}</td>
        <td>
          <a class="input">编辑</a>
          <a class="input">删除</a>
        </td>
      </tr>
  {/volist}
{/empty}
    </tbody>
  </table>
</div>

<!--内容底部-->
<div class="page-footer"><div class="btn-wrap">{$list->render()}</div></div>
<!--/内容底部-->

</form>
<script>
$(function () {

  $.AgentType.init({
    URL_DETAIL: "{:url('user.agent.type/detail')}",
    URL_DELETE: "{:url('user.agent.type/delete')}"
  });
  
  $('#aat').click(function () {
    console.log('添加');
    $.AgentType.ShowDetailDialog(0);
  });

  $('table.ltable td:last-child a.input:nth-child(1)').click(function () { // 修改
    var id = $(this).parents('tr').data('id');
    console.log('修改', id);
    $.AgentType.ShowDetailDialog(id);
  });

  $('table.ltable td:last-child a.input:nth-child(2)').click(function () { // 删除
    var id = $(this).parents('tr').data('id');
    console.log('删除', id);
    $.AgentType.ShowDeleteConfirm(id);
  });

});
</script>
</body>
{/block}